package com.test.learnaidl.service;

import android.app.Service;
import android.content.Intent;
import android.nfc.Tag;
import android.os.Binder;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;

import androidx.annotation.Nullable;

import com.test.learnaidl.PersonInterface;

public class PersonService extends Service {
    private static String TAG = "服务端 PersonService > ";
    private String mName = "服务端默认值";
    private int mAge = 20;

    private Binder mBinder = new PersonInterface.Stub() {
        @Override
        public void setName(String name) throws RemoteException {
            mName = name;
            Log.i("==",TAG+"setName name = "+name);
        }

        @Override
        public String getName() throws RemoteException {
            return mName;
        }

        @Override
        public void setAge(int age) throws RemoteException {
            mAge = age;
            Log.i("==",TAG+"setAge name = "+age);

        }

        @Override
        public int getAge() throws RemoteException {
            return mAge;
        }
    };


    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return mBinder;
    }

    @Override
    public void onCreate() {
        super.onCreate();
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        return super.onStartCommand(intent, flags, startId);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }

    @Override
    public boolean onUnbind(Intent intent) {
        return super.onUnbind(intent);
    }

    @Override
    public void onRebind(Intent intent) {
        super.onRebind(intent);
    }
}
